<template name="adminImportPrepare">
	<section class="page-container page-home page-static page-settings">
		{{> header sectionName=pageTitle}}
		<div class="content">
			{{#unless hasPermission 'run-import'}}
				<p>{{_ "You_are_not_authorized_to_view_this_page"}}</p>
			{{else}}
				{{#if isPreparing}}
					{{#if hasProgressRate}}
						{{ progressRate }}
					{{/if}}

					{{> loading}}
				{{else}}
					<a href="{{pathFor "admin-import"}}"><i class="icon-angle-left"></i> {{_ "Back_to_imports"}}</a><br><br>

					<div class="section">
						<h1>{{_ "Actions"}}</h1>
						<div class="section-content">
							<button class="button uncheck-deleted-users"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Uncheck_Deleted_Users"}}</span></button>
							<button class="button uncheck-archived-channels"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Uncheck_Archived_Channels"}}</span></button>
							<button class="button primary start"><i class="icon-send"></i><span>{{_ "Importer_Prepare_Start_Import"}}</span></button>
						</div>
					</div>

					<div class="section">
						<h1>{{_ "Messages"}}: {{message_count}}</h1>
					</div>

					{{#if users.length}}
						<div class="section">
							<h1>{{_ "Users"}}</h1>
							<div class="section-content">
								<ul>
									{{#each users}}
										{{#unless is_bot}}
											<li>
												<input type="checkbox" name="{{user_id}}" id="user_{{user_id}}" checked="checked" />
												<label for="user_{{user_id}}">{{username}} - {{email}}</label>
												{{#if is_deleted }} <em>({{_ "Deleted"}})</em>{{/if}}
												{{#if is_email_taken }} <em>({{_ "Duplicated_Email_address_will_be_ignored"}})</em>{{/if}}
											</li>
										{{/unless}}
									{{/each}}
								</ul>
							</div>
						</div>
					{{/if}}

					{{#if channels.length}}
						<div class="section">
							<h1>{{_ "Channels"}}</h1>
							<div class="section-content">
								<ul>
									{{#each channels}}
										<li>
											<input type="checkbox" name="{{channel_id}}" id="channel_{{channel_id}}" checked="checked" />
											<label for="channel_{{channel_id}}">{{name}}</label>
											{{#if is_archived}} <em>({{_ "Importer_Archived"}})</em>{{/if}}
											{{#if is_private}} <em>({{_ "Private_Group"}})</em>{{/if}}
										</li>
									{{/each}}
								</ul>
							</div>
						</div>
					{{/if}}
				{{/if}}
			{{/unless}}
		</div>
	</section>
</template>
